    {layout name="common/layout" /}
	
 <style>
 .rules-content{
 box-sizing: border-box;
 padding: 20px 30px;
 background:#f9f9f9;
 }
 textarea{
	 vertical-align: text-top;
	 width: 320px;
	 font-size: 15px;
 box-sizing: border-box;
 padding: 10px;
 height:500px
 }
 </style>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>

<div class="Hui-article-box" style="margin-top: 37px;">

	<div class="newCrumbs ">租赁规则/合约模板
			<span class="c-gray en">&gt;</span> 添加租赁详情模板
		</div>
	<div class="Hui-article">
			<form action="">
					<div class="rules-content">
						<div>
							<span>租赁详情模板名称：</span>
							<input style="margin:0;width:320px" type="text" id="leasing_rules_name" name="leasing_rules_name" class="input-text radius size-M  ">
						</div>                    
							<div style="margin-top:30px;">
									<span>租赁详情模板内容：</span>
									<textarea id="leasing_rules_content" name="leasing_rules_content">
									</textarea>
						</div>
						<!-- <textarea type="text/plain" name="goods_details_content" id="editor"></textarea> -->	
						<div class="btn-l">
							<input id="submitBtn" type="button" value="保存"  class="btn" >
							<a class="btn" style="margin-left: 20px;padding-top: -20px;" href="{:url('leasingrules/showlist')}">返回</a>
						</div>				
				 	</div>
			</form>
	</div>
</div>
	
 

<script> 

/* var um = UM.getEditor('leasing_rules_content',{ 
initialFrameWidth : "80%", 
initialFrameHeight : 350 
}); */


function getoldhistry() {
  window.history.back();
}
    $('#submitBtn').click(function(){
    	var leasing_rules_name = $('input[name=leasing_rules_name]').val();
    	var leasing_rules_content = $('#leasing_rules_content').val();
		
		if($("#leasing_rules_name").val()=='') {	 
		layer.msg("租赁详情模板名称不能为空!");
		$("#leasing_rules_name").focus();
		return ;
	 }
	   if($("#leasing_rules_content").val()=='') {	 
		layer.msg("租赁详情模板内容不能为空!");
		$("#leasing_rules_content").focus();
		return ;
	 } 
		
		
    	$.ajax({
          type: "POST",
          url: "<?php echo url('leasingrules/insert', '', false); ?>",
          dataType: 'json',
          cache: false,
          data: {'leasing_rules_name': leasing_rules_name,'leasing_rules_content': leasing_rules_content},
          success: function(data) {
            if(data.status == 1) 
            {
              layer.msg(data.msg,
              	{time:1000,end: function(index, layero){
   					location.href="{:url('leasingrules/showlist')}";
   				 	layer.close(index); 
  				}});

            }else{
              layer.msg(data.msg);
            }

          },
          error: function(xhr, status, error) {
            console.log(xhr);
            console.log(status);
            console.log(error);
          }
        });
    });
    
</script>
 